#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstring>
using namespace std;
const int N = 10010, M = 20010;
int h[N], e[M], ne[M], idx;
int q[N], din[N], dist[N];
int n, m;
void add(int a, int b)
{
    e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}
bool topsort()
{
    int hh = 0, tt = -1;
    for (int i = 1; i <= n; i++) if (din[i] == 0) q[++tt] = i;
    while (hh <= tt)
    {
        int t = q[hh++];
        for (int i = h[t]; ~i; i = ne[i])
        {
            int j = e[i];
            if (--din[j] == 0) q[++tt] = j;
        }
    }
    return tt == n - 1;
}
int main()
{
    memset(h, -1, sizeof h);
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        add(b, a);
        din[a]++;
    }
    if (!topsort())
    {
        cout << "Poor Xed" << endl;
        return 0;
    }
    for (int i = 1; i <= n; i++) dist[i] = 100;
    for (int i = 0; i < n; i++)
    {
        for (int j = h[q[i]]; ~j; j = ne[j])
        {
            int k = e[j];
            dist[k] = max(dist[k], dist[q[i]] + 1);
        }
    }
    int res = 0;
    for (int i = 1; i <= n; i++) res += dist[i];
    cout << res << endl;
    return 0;
}